<%@ page language="java" import="java.util.*,com.wit.service.impl.*,com.wit.po.*"  pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<% 
DepartmentserviceImp dsImp=new DepartmentserviceImp();
List<DtreeFirst> dflist=dsImp.DepartmentTree();
%>
 <% 
DepartmentserviceImp deimp=new DepartmentserviceImp();
List<Department> dlist=deimp.DepartmentList();
%>
<%
EmployeeserviceImp emser=new EmployeeserviceImp();
Employee Em=new Employee();
if(request.getAttribute("REmployee")==null)
{
Em=emser.NewEmployee();
}
if(request.getAttribute("REmployee")!=null)
{
Em=(Employee)request.getAttribute("REmployee");
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<title>部门管理</title>
	<link href="<%=basePath%>/style/main.css" rel="stylesheet" type="text/css" />
	<link type="text/css" rel="stylesheet"  href="<%=basePath%>/style/style.css" />
	<style>
		body#bodyTree{margin:8px;font-size:12px;color:#000;line-height:22px;}
		body#bodyTree a{color:#000;text-decoration:none;}
		body#bodyTree a:hover{color:#3366CC;padding:2px 0px 0px 0px;}
		#bodyTree ul{margin:0;padding:0;list-style:none;background:url(<%=basePath%>/images/tree/ullist.gif) repeat-y;}
		#bodyTree ul li{list-style:none;}
		#bodyTree .treeview li{background:transparent url(<%=basePath%>/images/tree/list.gif) no-repeat left center;padding-left:15px;/*tree list*/}
		#bodyTree .treeview li.submenu{background:transparent url(<%=basePath%>/images/tree/closed.gif) no-repeat left 0px;/*4 sub menu*/}
		#bodyTree .treeview li.closefolder{background:transparent url(<%=basePath%>/images/tree/closed.gif) no-repeat left 0px;/*closefolder style*/}
		#bodyTree .treeview li.openfolder{background:transparent url(<%=basePath%>/images/tree/open.gif) no-repeat left 0px;/*openfolder style*/}
		#bodyTree .treeview li.submenu ul{display:none;}
		#bodyTree ul li a.cur{font-weight:bold;color:#3366CC;padding:2px 2px 0px 2px;/*the current style*/}
		#bodyTree .treeview .submenu i{width:12px;height:12px;font-style:normal;font-size:10px;margin-left:-15px;margin-top:5px;float:left;display:inline;background:url(<%=basePath%>/images/tree/transparent.gif) no-repeat center; cursor:pointer;}
	</style>
	<script type="text/javascript" src="<%=basePath %>/images/tree/simpletreemenu.js">
	  </script>
	  
<style type="text/css">
<!--
#cmsTree {
 float: left;
 width: 200px;
}
#rightDiv {
 float: right;
 width: 800px;
}
#Containner {
 width: 1000px;
}
-->
</style>
  
  </head> 
  <body id="bodyTree">
  <script type="text/javascript">
 
  
  function test1(b)
  {
   window.open("EmployeeDetail?employeeId="+b+"","_self");
  }
  </script>
  <html>
  <body>
      <!-- 实际菜单数据开始 -->
     <div id="Containner">
	<div id="cmsTree">
	<ul id="treemenu3" class="treeview">
	<li><strong>所有部门</strong> <a href="javascript:ddtreemenu.flatten('treemenu3', 'expand')"><strong>展开</strong></a> <a href="javascript:ddtreemenu.flatten('treemenu3', 'contact')"><strong>收缩</strong></a></li>
	<%
	for(int i=0;i<dflist.size();i++)
	{
	  DtreeFirst  df=dflist.get(i);
	  Department dep=df.getAncestorD();
	  
	%>
	<li><span><%=dep.getDepartNameC()%></span>
	<%
	if(df.getSonD().size()>0)
	{ 
	%>
	<ul>
	<%
	Iterator it=dep.getEmployees().iterator();
	while(it.hasNext())
	{
	  Employee emp=(Employee)it.next(); 
	%>
	<li><span onClick="test1('<%= emp.getEmployeeId()%>')"><%= emp.getEmployeeNameC() %></span>
	<%
	 } 
	%>
	<%
	   List<DtreeSecond> dslist=df.getSonD(); 
	   for(int j=0;j<dslist.size();j++)
	   {
	     DtreeSecond dsecond=dslist.get(j);
	%>
	<li>
	   <i></i><span ><%=dsecond.getSubDepart().getDepartNameC()%></span>
	 <%
	      List<Department> deplist=dsecond.getSubList();
	      if(deplist.size()>0||dsecond.getSubDepart().getEmployees().size()>0)
	      {
	 %>
	    <ul>
	    <%
	        Iterator ite= dsecond.getSubDepart().getEmployees().iterator();
	        while(ite.hasNext())
	        {
	           Employee depname=(Employee)ite.next();
	    %>
	    
	    <li><span onClick="test1('<%= depname.getEmployeeId()%>')"><%= depname.getEmployeeNameC() %></span>
	    <%
	    } 
	    %>
	    <%
	       for(int k=0;k<deplist.size();k++)
	       {
	            Department department=deplist.get(k); 
	    %>
	       <li><span ><%=department.getDepartmentId()%></span></li>
	       <%
	        }
	       %>
	    </ul>  
	    <%
	    }
	    %>  
	</li>
	<%
	} 
	%>
	</ul>
	<%
	} 
	%>
	<%
	  } 
	%>
	</ul>
	
	</div>
	<div id="rightDiv" style="position:absolute">
	<table width="780" border="0" align="center" cellspacing="0" class="table">
  <tr>
    <td><div class="mainarea">
      <div class="search">
    
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table4">
          <tr>
           <td width="24%" align="center">
					<span class="clientinfo_but"><a href="newright_Team.jsp" target="_self">新增员工</a>
					</span>
				</td>
				<td width="14%" align="center">
					<span class="clientinfo_but"><a href="DeleteEmployeeAction" target="_self">删&nbsp;除</a>
					</span>
				</td>
          </tr>
          <tr>
            <td width="28%" colspan="2" bgcolor="#BBD2F7" class="title">基本资料</td>
          </tr>
          
         
          <tr>
            <td colspan="2"><table width="100%" border="0" cellspacing="2" cellpadding="0">
              
              <tr>
                <td width="12%" align="right" >员工编号：</td>
                <td width="46%" align="left" ><input type="text" name="employeeId" id="employeeId" value="<%=Em.getEmployeeId() %>" /></td>
                <td width="13%" align="left" >部门：</td>
                <td width="29%" align="left" ><label>
                  <select name="departmentId" id="departmentId">
                   <option value="<%= Em.getDepartment().getDepartmentId()%>" selected><%= Em.getDepartment().getDepartNameC()%></option>
                  <%
                    for(int i=0;i<dlist.size();i++)
                    { 
                    Department dep=dlist.get(i);  
                  %>
                    <option value="<%=dep.getDepartmentId() %>" ><%=dep.getDepartNameC()%></option>
 
                  <%
                  }
                  %>
                  </select>
                </label></td>
              </tr>
              <tr>
                <td align="right" >姓名(中)：</td>
                <td align="left" ><input type="text" name="employeeNameC" id="employeeNameC" value="<%=Em.getEmployeeNameC() %>"/></td>
                <td align="left" >姓名(英)：</td>
                <td align="left" ><input type="text" name="employeeNameE" id="employeeNameE" value="<%=Em.getEmployeeNameE() %>"/></td>
              </tr>
              
               <tr>
                <td align="right" >初始密码：</td>
                <td align="left" ><input type="text" name="password" id="password" value="<%=Em.getPassword() %>"/></td>
                <td align="left" >所属公司</td>
                <td align="left" >
                <select name="companyName" id="companyName" style="width:100px">
                    <option value="<%= Em.getCompanyName() %>" selected="selected"><%= Em.getCompanyName() %></option>
                    <option value="人寿保险" selected="selected">人寿保险</option>
                    <option value="平安保险">平安保险</option>
                    <option value="安康保险">安康保险</option>
                    <option value="太平洋保险">太平洋保险</option>
                </select></td>
              </tr>
              
              <tr>
                <td align="left" >身份证号：</td>
                <td align="left" ><input type="text" name="employeeIdcard" id="employeeIdcard" style="width:200px" value="<%=Em.getEmployeeIdcard() %>"/></td>
                <td align="right" >性别：</td>
                <td align="left" >
                <select name="employeeSex" id="employeeSex" style="width:50px">
                <%
                  if(Em.getEmployeeSex()=="M")
                  {
                 %>
                    <option value="M" selected="selected">男</option>
                    <option value="F">女</option>
                 <%} %>
                  <%
                  if(Em.getEmployeeSex()=="F")
                  {
                 %>
                    <option value="M" >男</option>
                    <option value="F" selected="selected">女</option>
                 <%} %>
                </select></td>
              </tr>
              <tr>
                <td colspan="4" align="left" >出生日期：
                  <input type="text" name="employeeBornDate" id="employeeBornDate" style="width:200px" value="<%=Em.getEmployeeBornDate() %>"/>
教育：
<select name="employeeEdu" id="employeeEdu" >
 <option value="本科" selected="selected">本科</option>
 <option value="专科">专科</option>
 <option value="高中">高中</option>
 <option value="初中">初中</option>
 <option value="硕士">硕士</option>
 <option value="博士">博士</option>
 <option value="博士后">博士后</option>
</select>
&nbsp;婚姻：
<select name="employeeMarrige" id="employeeMarrige" >
 <option value="1" selected="selected">已婚</option>
 <option value="0">未婚</option>
</select>
</td>
                </tr>
              
              <tr>
                <td colspan="4" align="left" >入司日期：
                  <input type="text" name="enterDate" id="enterDate" style="width:200px" value="<%=Em.getEnterDate() %>"/>
职位：
<select name="employeepositionId" id="employeepositionId" >
<option value="LCGW" selected="selected">理财顾问</option>
 <option value="LCZR">理财主任</option>
 <option value="XXJL">行销经理</option>
 <option value="GJXXJL">高级行销经理</option>
 <option value="LCJL">理财经理</option>
 <option value="QYJL">区域经理</option>
</select>
&nbsp;状态：
<select name="employeeStatu" id="employeeStatu" >
<option value="在职" selected="selected">在职</option>
 <option value="离职">离职</option>
</select></td>
                </tr>
              <tr>
                <td align="right" >地&nbsp; 址：</td>
                <td align="right" ><input type="text" name="employeeAddress" id="employeeAddress" style="width:240px" value="<%=Em.getEmployeeAddress() %>"/>
                  &nbsp;</td>
                <td align="left" >邮编： </td>
                <td align="left" ><input type="text" name="employeePc" id="employeePc"  value="<%=Em.getEmployeePc()%>"/></td>
              </tr>
              <tr>
                <td align="right" >&nbsp;手机：</td>
                <td align="right" ><input type="text" name="employeePh" id="employeePh" style="width:240px" value="<%=Em.getEmployeePh()%>"/>
                  &nbsp;</td>
                <td align="left" >电话： </td>
                <td align="left" ><input type="text" name="employeeTel" id="employeeTel" value="<%= Em.getEmployeeTel()%>"/></td>
              </tr>
              <tr>
                <td align="right" >电子邮箱：</td>
                <td align="right" ><input type="text" name="employeeemail" id="employeeemail" style="width:240px" value="<%= Em.getEmployeeemail()%>"/>
                  &nbsp;</td>
                <td align="left" >传真： </td>
                <td align="left" ><input type="text" name="employeefax" id="employeefax" value="<%=Em.getEmployeefax()%>"/></td>
              </tr>
              
               <tr>
                <td align="right" >员工押金：</td>
                <td align="right" ><input type="text" name="edeposit" id="edeposit" style="width:100px" value="<%= Em.getEdeposit()%>"/>
                  &nbsp;</td>
                <td align="left" >展业证号： </td>
                <td align="left" ><input type="text" name="ezhanye" id="ezhanye"  value="<%= Em.getEzhanye()%>"/></td>
              </tr>
              
               <tr>
                <td align="right" >展业证有效期至：</td>
                <td align="right" ><input type="text" name="evalidate" id="evalidate" style="width:100px"  value="<%= Em.getEvalidate()%>"/>
                  &nbsp;</td>
                <td align="left" >代理证号： </td>
                <td align="left" ><input type="text" name="eadgen" id="eadgen"   value="<%= Em.getEadgen()%>"/></td>
              </tr>
               <tr>
                <td align="right" >合同号：</td>
                <td align="right" ><input type="text" name="contacct" id="contacct" style="width:100px"  value="<%=Em.getContacct()%>"/>
                  &nbsp;</td>
                <td align="left" > </td>
                <td align="left" ></td>
              </tr>
            </table>
                <table width="100%" border="0" cellspacing="2" cellpadding="0">
                    
                    <tr>
                      <td width="100%" align="center">
                      <input name="input" type="submit"  value="保存"  class="btn_1"/>
                      &nbsp;
                      <input name="input" type="reset"  value="修改"  class="btn_1"/></td>
                    </tr>
                </table></td>
          </tr>
        </table>
       </div>
    </div></td>
  </tr>
</table>
	</div>
	
	</div>
	<script type="text/javascript">
	ddtreemenu.createTree("treemenu3", true);
	</script>
	
	
</body>
</html>
